/*******************************************************************************
* Project: QSAR(Cute Software Architecture)
*
* Copyright: Copyright(C) 2024 by YuetingBen, All Rights Reserved
*
* File name: CanIfCfg.c
*
* Brief: ;
*
* Author: Yueting.Ben
*
* Module: CanIf
*
*******************************************************************************/

/** HEADER FILES **/
#include "CanIfCfg.h"


/** MACRO DEFINITION **/


/** TYPEDEF DEFINITION **/


/** LOCAL DATA DECLARATION **/
const CanIf_TxPduCfgType Canif_TxPduCfg[CANIF_TX_INDEX_MAX];

const CanIfTxPduCfgType CanIfTxPduCfg[CanIfConf_CanIfTxPduCfg_Pdu_Max];
const CanIfRxPduCfgType CanIfRxPduCfg[CanIfConf_CanIfRxPduCfg_Pdu_Max];

const PduIndicationFuncType Canif_RxIndicationFuncCfg[CANIF_RX_PDU_UL_MAX];

/** LOCAL DATA **/
const CanIfCtrlCfgType CanIfCtrlCfg[CanIfConf_CtrlDrv_Max] = 
{
    /* CanCtrlRef,   CtrlId,  WakeupSupport  */
    {NULL_PTR,       0u,      SET }
};


const CanIfCtrlDrvCfgType CanIfCtrlDrvCfg[CanIfConf_CtrlDrv_Max] = 
{
    /* CtrlDrv_0 */
    {
        /* CanCtrlRef,  CtrlId,               WakeupSupport */
        {NULL_PTR,      CanIfConf_CtrlDrv_0,  RESET }
    }
};

const CanIfHrhCfgType CanIfHrhCfg[CanIfConf_CtrlDrv_Max] = 
{
    /* CanCtrlId,                                                HrhIdSymRef,   SoftwareFilter,  RangeCfg  */
    {(CanIfCtrlCfgType*)&CanIfCtrlCfg[CanIfConf_CtrlDrv_0],    NULL_PTR,      SET,               {0x500, 0x5FF}}
};

const CanIfBufferCfgType CanIfBufferCfg[CanIfConf_CtrlDrv_Max] = 
{
    /* CanIfBufferHthRef,                                  BufferSize */
    {(CanIfHthCfgType*)&CanIfHrhCfg[CanIfConf_CtrlDrv_0], 8u}
};

const CanIfTxPduCfgType CanIfTxPduCfg[CanIfConf_CanIfTxPduCfg_Pdu_Max] = 
{
    /* CanIdType,                     TxPduId,                                   CanId,  Upper layer,            BufferRef,                                                     TxPduRef */
    {CANIF_TX_PDU_TYPE_STANDARD_CAN,  CanIfConf_CanIfTxPduCfg_Pdu_Channel1_101,  0x0101u, CANIF_TX_PDU_UL_CAN_TP, (CanIfBufferCfgType*)&CanIfBufferCfg[CanIfConf_CtrlDrv_0],   (PduType*)&Pdu[ComStackConf_Pdu_Tx_Channel1_Can1_0x101]},
    {CANIF_TX_PDU_TYPE_STANDARD_CAN,  CanIfConf_CanIfTxPduCfg_Pdu_Channel1_102,  0x0102u, CANIF_TX_PDU_UL_CAN_TP, (CanIfBufferCfgType*)&CanIfBufferCfg[CanIfConf_CtrlDrv_0],   (PduType*)&Pdu[ComStackConf_Pdu_Tx_Channel1_Can2_0x102]},
    {CANIF_TX_PDU_TYPE_STANDARD_CAN,  CanIfConf_CanIfTxPduCfg_Pdu_Channel1_720,  0x0720u, CANIF_TX_PDU_UL_CAN_TP, (CanIfBufferCfgType*)&CanIfBufferCfg[CanIfConf_CtrlDrv_0],   (PduType*)&Pdu[ComStackConf_Pdu_Tx_Channel1_Can3_0x720]},
    {CANIF_TX_PDU_TYPE_STANDARD_CAN,  CanIfConf_CanIfTxPduCfg_Pdu_Channel1_500,  0x0500u, CANIF_TX_PDU_UL_CAN_NM, (CanIfBufferCfgType*)&CanIfBufferCfg[CanIfConf_CtrlDrv_0],   (PduType*)&Pdu[ComStackConf_Pdu_Tx_Channel1_Can4_0x500]},
};

const CanIfRxPduCfgType CanIfRxPduCfg[CanIfConf_CanIfRxPduCfg_Pdu_Max] = 
{
    /* RxPduHrhIdRef                                           PduID,                                    CanId,                Length,   Upper layer              RxPduRef */
    {(CanIfHrhCfgType*)&CanIfHrhCfg[CanIfConf_CtrlDrv_0],      CanIfConf_CanIfRxPduCfg_Pdu_Channel1_201, 0x0201u,                8u,      CANIF_RX_PDU_UL_PDUR,   (PduType*)&Pdu[ComStackConf_Pdu_Rx_Channel1_Can1_0x201]},
    {(CanIfHrhCfgType*)&CanIfHrhCfg[CanIfConf_CtrlDrv_0],      CanIfConf_CanIfRxPduCfg_Pdu_Channel1_202, 0x0202u,                8u,      CANIF_RX_PDU_UL_PDUR,   (PduType*)&Pdu[ComStackConf_Pdu_Rx_Channel1_Can2_0x202]},
    {(CanIfHrhCfgType*)&CanIfHrhCfg[CanIfConf_CtrlDrv_0],      CanIfConf_CanIfRxPduCfg_Pdu_Channel1_710, 0x0710u,                8u,      CANIF_RX_PDU_UL_CAN_TP, (PduType*)&Pdu[ComStackConf_Pdu_Rx_Channel1_Can3_0x710]},
    {(CanIfHrhCfgType*)&CanIfHrhCfg[CanIfConf_CtrlDrv_0],      CanIfConf_CanIfRxPduCfg_Pdu_Channel1_7DF, 0x07DFu,                8u,      CANIF_RX_PDU_UL_CAN_TP, (PduType*)&Pdu[ComStackConf_Pdu_Rx_Channel1_Can4_0x7DF]},
    {(CanIfHrhCfgType*)&CanIfHrhCfg[CanIfConf_CtrlDrv_0],      CanIfConf_CanIfRxPduCfg_Pdu_Channel1_Nm,  CANID_INVALID_VALUE,   8u,       CANIF_RX_PDU_UL_CAN_NM, (PduType*)&Pdu[ComStackConf_Pdu_Rx_Channel1_Can5_NM]},
};

const PduIndicationFuncType Canif_RxIndicationFuncCfg[CANIF_RX_PDU_UL_MAX] = 
{
    NULL_PTR,
    CanTp_RxIndication, /* CAN_TP */
    PduR_CanIfRxIndication, /* PDUR */
    CanNm_RxIndication, /* CAN_NM */
    NULL_PTR, /* J1939TP */
    NULL_PTR, /* XCP */
    NULL_PTR, /* CDD */
    NULL_PTR, /* J1939NM */
    NULL_PTR  /* CAN_TSYN */
};

